package com.dao.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.service.front.ISingerServiceFront;



@RequestMapping("/singer")
@Controller
public class SingerControllerFront {
	@Autowired
	private ISingerServiceFront singerServiceFront;
	
	@RequestMapping("/list")
	public String list(Model model){
		List<Map<String, Object>> singerList=singerServiceFront.list();
		model.addAttribute("singerList",singerList);
		
		List<Map<String,Object>> querySingerTypeList = singerServiceFront.querySingerType();
		model.addAttribute("querySingerTypeList", querySingerTypeList);
		return "singerList";
	}
	
	@RequestMapping("/querySingerTypeId")
	public String querySingerTypeId(Model model,Integer singerTypeId) {
		List<Map<String, Object>> querySingerTypeIdList = singerServiceFront.querySingerTypeId(singerTypeId);
		model.addAttribute("querySingerTypeIdList", querySingerTypeIdList);
		
		List<Map<String,Object>> querySingerTypeList = singerServiceFront.querySingerType();
		model.addAttribute("querySingerTypeList", querySingerTypeList);
		
		
		return "singerList";
	}
	

	@RequestMapping("/list2")
	public String list2(Model model,Integer singerId ,Integer musicId){
		
		Map<String, Object> mapSinger = singerServiceFront.mapSinger(singerId);
	    model.addAttribute("mapSinger", mapSinger);
		
	    List<Map<String, Object>> listSingerMusicList = singerServiceFront.listSingerMusic(singerId);
		model.addAttribute("listSingerMusicList", listSingerMusicList);
	    
	    List<Map<String, Object>> listSingerSpecialList=singerServiceFront.listSingerSpecial(singerId);
	    model.addAttribute("listSingerSpecialList",listSingerSpecialList);

	    List<Map<String, Object>> listSingerMvList = singerServiceFront.listSingerMv(singerId);
		model.addAttribute("listSingerMvList", listSingerMvList);
		
		Map<String, Object> mapMusic = singerServiceFront.mapMusic(singerId);
		model.addAttribute("mapMusic", mapMusic);
		
		Map<String, Object> mapSpecial = singerServiceFront.mapSpecial(singerId);
		model.addAttribute("mapSpecial", mapSpecial);
		
		Map<String, Object> mapMv = singerServiceFront.mapMv(singerId);
		model.addAttribute("mapMv", mapMv);
		return "singer";
		
	}
	
}
